package cn.healthlink.proxy;
/**
 * @author dengzhiyuan
 * @version 1.0
 * @time 2021/1/20 14:50
 */
public class ProxyMain {

	public static void main(String[] args) {
		new ProxyMain().test1();
	}

	/**
	 * 测试两层代理
	 * @author dengzhiyuan
	 * @version 1.0
	 * @time 2021/2/24 14:50
	 * @param 
	 * @return 
	 */
	private void test1(){
		Teacher teacher = new TeacherImpl();
		teacher.sayHello("dzy");
		System.out.println("--------------------------------------------");
		ProxyInvocationHandler2 invocationHandler2 = new ProxyInvocationHandler2(teacher);
		Teacher proxy2 = (Teacher) invocationHandler2.getProxy();

		ProxyInvocationHandler invocationHandler1 = new ProxyInvocationHandler(proxy2);
		Teacher proxy1 = (Teacher) invocationHandler1.getProxy();

		proxy1.sayHello("dzy");
	}


}
